﻿using Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DearInformation.Controllers
{
    public class ChooseActionController : Controller
    {
        //
        // GET: /ChooseAction/

        public ActionResult ActionList()
        {
            return View();
        }

        public JsonResult GetAllAction()
        {
            ChooseActionServer server = new ChooseActionServer();
            List<ChooseAction> list = server.GetAllAction();
            return Json(Json(list), JsonRequestBehavior.AllowGet);
        }

        public ContentResult AddAction()
        {
            ChooseActionServer server = new ChooseActionServer();
            ChooseAction action = new ChooseAction() { ItemName = Request["itemName"] ?? string.Empty };
            server.Insert(action);

            ContentResult c = new ContentResult();
            c.Content = "添加成功";

            return c;
        }
    }
}
